<{include file="public_html/header.html"}>
<{include file="public_html/left_menu.html"}>
<link href="/static/school/css/layout.css" type="text/css" rel="stylesheet" />
    <script src="/static/public/jquery-1.11.1.min.js" type="text/javascript"></script>
    <!--私有部分-->
    <link href="/static/school/css/frame.style.css" type="text/css" rel="stylesheet" />

    <link href="/static/school/css/default.style.css" type="text/css" rel="stylesheet" />
    <link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
    <script src="/static/public/layer/src/layui.js"></script>
    <script src="/static/school/js/default.common.js" type="text/javascript"></script>
<script type="text/javascript">
	var dire = 'user';
	var thumb = 'big_thumb,middle_thumb,small_thumb';
	var fileNumLimit = 1;
</script>
<blockquote class="layui-elem-quote"><{$action}></blockquote>

<form class="layui-form layui-form-pane" method="post" action="/video/<{if $videos_info.id|default:"" > 0}>edit<{else}>save<{/if}>" id="add_user">
	<input type="hidden" value="<{$videos_info['id']|default:"0"}>" name="id" />

	<div class="layui-form-item">
		<label class="layui-form-label">视频标题</label>
		<div class="layui-input-block">
            <input type="text" class="layui-input" name="title" lay-verify="required" value="<{$videos_info.title|default:""}>" >
		</div>
	</div>

	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label">视频描述</label>
		<div class="layui-input-block">
            <textarea name="description" class="layui-textarea"><{$videos_info.description|default:""}></textarea>
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">课程分类：</label>
		<div class="layui-input-inline">
			<select name="cate_id" class="abc" lay-verify="required" id="cate_id" placeholder="请选择" lay-filter="cate_id">
				<option value="">课程分类</option>
				<{foreach from=$cate item=item}>
					<option value="<{$item.id}>" <{if $videos_info['cate_id']|default:"" == $item.id}>selected="selected"<{/if}>><{$item.name}></option>
				<{/foreach}>
			</select>
		</div>
		<div class="layui-form-mid layui-word-aux"><{if empty($cate)}>还没有课程分类，请<a href="/course/cate_publish" class="c-52a1fa">添加课程分类</a><{/if}></div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">课程科目：</label>
		<div class="layui-input-inline">
			<select name="subject_id" lay-verify="required" id="subject" placeholder="请选择" lay-filter="subject">
				<option value="">请选择科目</option>
				<{foreach from=$subject item=item}>
                    <option value="<{$item.id}>" <{if $videos_info['subject_id']|default:"" == $item.id}>selected="selected"<{/if}>><{$item.name}></option>
                <{/foreach}>
			</select>
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">视频封面图</label>
		<div class="layui-input-block">
            <div id="uploader2" class="upload_box" style="float:left; width:420px;">
            	<input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
                <div class="queueList">
                    <div id="dndArea2" class="placeholder dndArea">
                        <div id="filePicker2" class="filePicker"></div>
                        <p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
                    </div>
                </div>
                <div class="statusBar" style="display:none;">
                    <div class="progress">
                        <span class="text">0%</span>
                        <span class="percentage"></span>
                    </div><div class="info"></div>
                    <div class="btns">
                        <div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
                    </div>
                </div>
                <div class="upload_img_input" input_name='image_url'></div>
            </div>
            <{if isset($videos_info['image_url']) AND $videos_info['image_url'] != ''}>
	  			<div class="layui-inline" style="float:left;"><img src="<{$videos_info['image_url']}>" style="max-height:175px;"/></div>
	  		<{/if}>
		</div>
	</div>

	<div class="layui-form-item">
	  		<label class="layui-form-label">上传视频</label>
			    <div class="layui-input-block">
		            <div id="uploader4" class="upload_box" style="float:left;">
		            	<input type="hidden" id="writetoken" value="<{'VIMG'|get_qiniu_token}>" />
		                <div class="queueList">
		                    <div id="dndArea4" class="placeholder dndArea">
		                        <div id="filePicker4" class="filePicker"></div>
		                        <p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
		                    </div>
		                </div>
		                <div class="statusBar" style="display:none;">
		                    <div class="progress">
		                        <span class="text">0%</span>
		                        <span class="percentage"></span>
		                    </div><div class="info"></div>
		                    <div class="btns">
		                        <div id="filePickerBut4" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
		                    </div>
		                </div>
		                <div class="upload_img_input" input_name='video_url'></div>
		            </div>
		  		</div>
          	<div class="Validform_checktip oi_ab ab_380px"></div>
		</div>
	<div class="h60"></div>

	<div class="layui-input-block">
  		<button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>

<script>
	$(function() {

		layui.use(['form','layedit','jquery'], function() {
			var form = layui.form();
			var layedit = layui.layedit;
			$ = layui.jquery;
			layedit.build('detail'); //建立编辑器
			//监听提交
			form.on('submit(formDemo)', function(data) {
				layer.msg(JSON.stringify(data.field));
				return false;
			});
			form.on('select(cate_id)', function(data){
				var ii = layer.load();
				var id = data.value;
				$("#course_id").html('<option value="">请选择科目</option>');
				form.render('select');
			    $.ajax({
					type: "POST",
					url: "/course/get_cate_subject",
					data: {id:id},
					dataType: "json",
					success: function (data) {
						var ddl = $("#subject");
						var html ='<option value="">请选择科目</option>';
						$(data).each(function (key) {
							html += "<option value='"+data[key].id+"'>"+data[key].name+"</option>";
						});
						$("#subject").html(html);
						form.render('select');
						layer.close(ii);
					}
				});
			});  
		});


	})
	
</script>

<script type="text/javascript" src="/static/public/webupload/webuploader.js"></script>
<script type="text/javascript" src="/static/public/webupload/upload.js"></script>
<script src="/static/manage/js/common.js"></script>
<script type="text/javascript">
var fileNumLimit = 1;
</script>